<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    账户：<input type="text" v-model="username"> <br><br>
    密码：<input type="password" v-model="password"> <br><br>
    <button @click="login">登录</button>
    <button @click="reset">重置</button>
</div>
<script src="vue.js"></script>
<script>
    /**
     * v-model:
     * 1. 数据改变后，呈现的页面结果会更新
     * 2. 页面结果更新后，数据也会随之而变
     *
     */
    const app = new Vue({
        el: '#app',
        data: {
            username: '',
            password: ''
        },
        methods: {
            login() {
                console.log('登录：', this.username)
            },
            reset() {
                this.username = '';
                this.password = '';
            }
        }
    })
</script>
</body>
</html>